CC4/CC5/CCM/CC7 (RtB) Terrain file format
(PC-Intel-like byte format: all in Little Endian)

header 20 bytes

'IRPS'	4 bytes	// header ID (SPRI in reverse)
0001h	4 bytes	// version, always 0001h
03E8h	2 bytes	// unknown, always 1000 (decimal)
short	2 bytes	// number of entries in file
short	2 bytes	// number of static animation sequences
short	2 bytes	// number of direction-based animation sequences
short	2 bytes	// bits per pixel ?? = 003Fh for Terrain
03E9h	2 bytes	// unknown, always 1001 (decimal)

each sprite entry (compressed graphics)

short	2 bytes	//width in pixels
short	2 bytes	// height in pixels
short	2 bytes	// hotspot-X
short	2 bytes	// hotspot-Y
long	4 bytes	// number of data bytes to follow
(height * 2 bytes)	// offset-table: offset of each line from beginning of pixel data
pixel-datas

for CC2/CC3 only: if the line's offset value in the offset-table is coded as FFFFh, 
then the entire line is white and no pixels are stored in the pixel-datas for this line.

compression bytes used in pixel-datas:
00h followed by number of pixels: transparent pixel amount to come
FFh followed by number of pixels: colored pixel amount to come
followed by 2-byte pixel values per pixel
F5h followed by number of pixels: shadow pixel amount to come
EDh end of line byte

EDh followed by 00h: end of pixel data reached (CC4/CC5/CCM/RtB only)

Appendix: 2024 bytes or more


Caution: in CC4/CC5/CCM/RtB each sprite entry is terminated by a zero byte 00h (Terrain file and *.spr files). This zero byte does not occur in CC2 and CC3 sprite files.


last revised: Dec. 21st, 2005, Mafi